/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package mnstudent.presentationlayer;

import mnstudent.global.MyTableCellRender;
import mnstudent.global.DataTable;
import mnstudent.global.Standard;
import mnstudent.businessLayer.AcademicYearBLL;
import mnstudent.businessLayer.InfoSemesterYearBLL;
import mnstudent.businessLayer.ListSubjectOpenBLL;
import mnstudent.businessLayer.SemesterBLL;
import mnstudent.datatranferobject.AcademicYearDTO;
import mnstudent.datatranferobject.InfoSemesterYearDTO;
import mnstudent.datatranferobject.ListSubjectOpenDTO;
import mnstudent.datatranferobject.SemesterDTO;
import mnstudent.datatranferobject.SubjectDisplay;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Vector;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author lee
 */
public class frmListSubjectOpen extends javax.swing.JPanel {

    private ListSubjectOpenBLL m_ListSubjectOpenBLL;
    private SemesterBLL m_SemesterBLL;
    private AcademicYearBLL m_AcademicYearBLL;
    private InfoSemesterYearBLL m_InfoSemesterYearBLL;
    private SemesterDTO objAddNewSemester;
    private AcademicYearDTO objAddNewYear;
    ArrayList<SemesterDTO> listSemesterObj;
    ArrayList<AcademicYearDTO> listYearObj;
    ArrayList<SubjectDisplay> listSubjectOpen, listSubjectOpenToUpdate;
    //private boolean m_isSave = false;
    private DefaultTableModel m_Model, m_ModelOpenSubject;
    private final SimpleDateFormat formatDate= new SimpleDateFormat("dd/MM/yyyy");
    private Date dateStartRegistrationCourse;  
    /**
     * Creates new form frmFaculty
     */
    public frmListSubjectOpen() {
        initComponents();
        initControls();
        prepare();
    }

    private void initControls()
    {
       if(this.jxTbOpenSubjects.m_isAdd||this.jxTbOpenSubjects.m_isUpdate)
       {
           jxBtnAddTo.setEnabled(true);
           jxBtnRemove.setEnabled(true);
           jxBtnCancel.setEnabled(true);
           jxBtnSave.setEnabled(true);
           jxBtnAdd.setEnabled(false);
           jxBtnUpdate.setEnabled(false);
           jxCbSemester.setEnabled(false);
           jxCbYear.setEnabled(false);
       }
       else
       {
           jxBtnAddTo.setEnabled(false);
           jxBtnRemove.setEnabled(false);
           jxBtnCancel.setEnabled(false);
           jxBtnSave.setEnabled(false);
           jxBtnAdd.setEnabled(false);
           jxBtnUpdate.setEnabled(true);
           jxBtnDelete.setEnabled(true);
            jxCbSemester.setEnabled(true);
           jxCbYear.setEnabled(true);
       }
    }
    
    private void prepare(){
      
        //Set lai text cac button cua dialog
        UIManager.put("OptionPane.cancelButtonText", "Hủy");
        UIManager.put("OptionPane.noButtonText", "Không");
        UIManager.put("OptionPane.okButtonText", "Có");
        UIManager.put("OptionPane.yesButtonText", "Vâng");
        //
        this.m_ListSubjectOpenBLL = new ListSubjectOpenBLL();
        this.m_SemesterBLL = new SemesterBLL();
        this.m_AcademicYearBLL = new AcademicYearBLL();
        m_InfoSemesterYearBLL = new InfoSemesterYearBLL();
        listSubjectOpen = new ArrayList<>();
        bindingDataToComboBox();
         
        m_Model = (DefaultTableModel)jxTbAllSubjects.getModel();
        DataTable.addRow(m_ListSubjectOpenBLL.getAllSubjectWithKindOfSubject(), m_Model);
        //get selected item
        jxTbAllSubjects.setDefaultRenderer(Object.class, new MyTableCellRender());
      
        //neu co dl thi do mac dinh row dau tien
        if(jxTbAllSubjects.getRowCount()>0)
        {
            jxTbAllSubjects.setRequestFocusEnabled(true);
            jxTbAllSubjects.requestFocus();
            jxTbAllSubjects.changeSelection(jxTbAllSubjects.getRowCount()-1, jxTbAllSubjects.getRowCount()-1, false, false);
        }
        
        //Du len ben JTable cac mon dc mo
        m_ModelOpenSubject = (DefaultTableModel)jxTbOpenSubjects.getModel();
        String idYear = ((AcademicYearDTO)jxCbYear.getSelectedItem()).getAcademicYearID();
        String idSemester =  ((SemesterDTO)jxCbSemester.getSelectedItem()).getSemesterID();
        listSubjectOpen = m_ListSubjectOpenBLL.getAllListSubjectOpenBySemesterYearToArray(idYear, idSemester);
        DataTable.addRow(m_ListSubjectOpenBLL.getAllListSubjectOpenBySemesterYear(idYear, idSemester), m_ModelOpenSubject);
        jxTbOpenSubjects.setDefaultRenderer(Object.class, new MyTableCellRender());
        
        initJButton(jxCbYear.getSelectedItem().toString());  
    }
    
    private void bindingDataToComboBox()
    {
         //ComboxBox Hoc ky
        listSemesterObj = m_SemesterBLL.getAllSemesterToArray();
        objAddNewSemester = new SemesterDTO("HKThemMoi", "Thêm mới...");
        listSemesterObj.add(objAddNewSemester);
        DefaultComboBoxModel dfCbModelS = new DefaultComboBoxModel(listSemesterObj.toArray());
        jxCbSemester.setModel(dfCbModelS);
        
        //ComboxBox Nam Hoc
         listYearObj = m_AcademicYearBLL.getAllAcademicYearToArray();
        objAddNewYear = new AcademicYearDTO("NHThemMoi", "Thêm mới...");
        listYearObj.add(objAddNewYear);
        DefaultComboBoxModel dfCbModel = new DefaultComboBoxModel(listYearObj.toArray());
        jxCbYear.setModel(dfCbModel);
    }
    
     private void initJTableForSubjectOpen(ArrayList<SubjectDisplay> _arrSubjectOpen)
    {
        m_ModelOpenSubject = (DefaultTableModel) jxTbOpenSubjects.getModel();
        m_ModelOpenSubject.fireTableDataChanged();
        m_ModelOpenSubject.fireTableStructureChanged();
        if(_arrSubjectOpen.size()>0){
            m_ModelOpenSubject.getDataVector().removeAllElements();
        
            for(SubjectDisplay obj : _arrSubjectOpen)
            {
                Vector _row = new Vector(); 
                _row.addElement(obj.getSubjectID());
                _row.addElement(obj.getNameOfSubject());
                _row.addElement(obj.getNameKindOfSubject());
                _row.addElement(obj.getCoutSCredit());
                m_ModelOpenSubject.addRow(_row);     
            }
        }
        else
        {
            if(m_ModelOpenSubject.getRowCount()>0)
            {
                for(int i = m_ModelOpenSubject.getRowCount() - 1; i>=0; i--)
                    m_ModelOpenSubject.removeRow(i);
            }
        }
        jxTbOpenSubjects.setDefaultRenderer(Object.class, new MyTableCellRender());

    } 
     
    /**
     * Ham xoa 1 khoa dc chon
     * @param rowSelected
     * @return 
     */
    private boolean isDelete()
    {
        boolean m_isDelete = false;

        String idYear = ((AcademicYearDTO)jxCbYear.getSelectedItem()).getAcademicYearID();
        String idSemester = ((SemesterDTO)jxCbSemester.getSelectedItem()).getSemesterID();

        if(m_ListSubjectOpenBLL.deleteListSubjectOpenBySemesterYearFromDatabase(idYear, idSemester)){
            m_isDelete = true;
            listSubjectOpen.clear();
            initJTableForSubjectOpen(listSubjectOpen);
        }

        return m_isDelete;
    }

    /**
     * Ham thuc hien insert Khoa xuong database
     * @return 
     */
    private void saveToDatabase()
    {
        if(checkData())
        {          
            SemesterDTO objSemester = (SemesterDTO)jxCbSemester.getSelectedItem();
            AcademicYearDTO objAcademicYear = (AcademicYearDTO)jxCbYear.getSelectedItem();
            
            for(SubjectDisplay objSub: listSubjectOpen)
            {
                ListSubjectOpenDTO obj = new ListSubjectOpenDTO(objAcademicYear.getAcademicYearID(), objSemester.getSemesterID(), objSub.getSubjectID());
                if(!m_ListSubjectOpenBLL.insertListSubjectOpenToDatabase(obj))
                {
                    JOptionPane.showMessageDialog(null, 
                        "Thêm thất bại môn học: "+ objSub.getNameOfSubject(), 
                        "Lỗi", 
                        JOptionPane.YES_OPTION);
                    this.jxTbOpenSubjects.m_isAdd = false;
                    initControls();
                }
            }
          
            this.jxTbOpenSubjects.m_isAdd = false;
            initControls();
        }
    }

    /**
     * Ham thuc hien cap nhat Khoa
     * @return 
     */
    private void updateToDatabase()
    {
        if(checkData())
        {    
            SemesterDTO objSemester = (SemesterDTO)jxCbSemester.getSelectedItem();
            AcademicYearDTO objAcademicYear = (AcademicYearDTO)jxCbYear.getSelectedItem();
            //Xóa sach du li cu
            for(SubjectDisplay objSub : listSubjectOpen)
            {
                ListSubjectOpenDTO obj = new ListSubjectOpenDTO(objAcademicYear.getAcademicYearID(),
                        objSemester.getSemesterID(), objSub.getSubjectID());
                    if(!m_ListSubjectOpenBLL.deleteListSubjectOpenFromDatabase(obj))
                    {
                        JOptionPane.showMessageDialog(null, 
                        "Xóa thất bại môn học: "+ objSub.getNameOfSubject(), 
                        "Lỗi", 
                        JOptionPane.YES_OPTION);
                    }
            }
            //them du lieu moi zo 
            for(SubjectDisplay objSubOpen: listSubjectOpenToUpdate)
            {
                ListSubjectOpenDTO obj = new ListSubjectOpenDTO(objAcademicYear.getAcademicYearID(),
                        objSemester.getSemesterID(), objSubOpen.getSubjectID());
                if(!m_ListSubjectOpenBLL.insertListSubjectOpenToDatabase(obj))
                {
                    JOptionPane.showMessageDialog(null, 
                        "Thêm thất bại môn học: "+ objSubOpen.getNameOfSubject(), 
                        "Lỗi", 
                        JOptionPane.YES_OPTION);
                    this.jxTbOpenSubjects.m_isUpdate = false;
                    initControls();
                }
            }                 
            this.jxTbOpenSubjects.m_isUpdate = false;
            initControls();
        }
    }
     /**
     * Ham thuc hien viec cap nhat va update
     */
     private void save()
    {
        if(this.jxTbOpenSubjects.m_isAdd)
        {
            saveToDatabase();
        }
        else
            if(this.jxTbOpenSubjects.m_isUpdate)
            {
                updateToDatabase();
            }
    }
    
    private void cancelAction()
     {
        this.jxTbOpenSubjects.m_isAdd = false;
        this.jxTbOpenSubjects.m_isUpdate = false;
        initControls(); 
        jxCbSemester.setSelectedIndex(0);
        jxCbYear.setSelectedIndex(0);
     }
   
    private boolean checkData()
    {
        if(listSubjectOpen.size()==0||
                jxCbSemester.getSelectedIndex()==-1||
                jxCbYear.getSelectedIndex()==-1){
            JOptionPane.showMessageDialog(null, "Dữ liệu không được bỏ trống!");
            return false;
        }
        return true;
    }
    //nếu mà ngày hiện tại nhỏ hơn ngày bắt đầu đk học phần và thuộc năm học hiện tại thì cho chỉnh sửa--> show nút "Sửa đổi"
    //Ngược lại thì chỉ cho xem, //còn năm học mà nhỏ hơn năm hiện tại thì chi cho xem thui
    private boolean compareAcademicYearWithCurrentYear(String _input)
    {
        //còn năm học mà nhỏ hơn năm hiện tại thì chi cho xem thui    
        int rs = 0;
        int currentYear = Standard.getDateSystem().getYear() + 1900;
        int[] temp = Standard.cutStringGetArrayInt(_input);
        for(int i = 0; i<temp.length; i++)
            if(temp[i] == currentYear)
                return true;
      
        return false;
    }

    /**
     * Ham sét button trên form này
     * 
     */
    private void initJButton(String _input)
    {
        if(!compareAcademicYearWithCurrentYear(_input))//ẩn hết các nút, không cho chỉnh sửa
        {
            jxBtnAdd.setEnabled(false);
            jxBtnUpdate.setEnabled(false);
            jxBtnDelete.setEnabled(false);
            jxBtnCancel.setEnabled(false); 
            jxBtnAddTo.setEnabled(false);
            jxBtnRemove.setEnabled(false); 
       }else{//nguoc lai: nam he thong bang nam dk mon hoc
            //neu trong bang danh sach cac mon mo co dl thi chinh sua
            //chua co thi them moi--ok
             if(dateStartRegistrationCourse.after(Standard.getDateSystem())){//neu ngay bat dau sau ngay hien tai thi cho chinh sua
                if(listSubjectOpen.size()>0){
                    jxBtnUpdate.setEnabled(true);
                    jxBtnDelete.setEnabled(false);
                    jxBtnCancel.setEnabled(false); 
                    jxBtnAddTo.setEnabled(false);
                    jxBtnRemove.setEnabled(false); 
                    jxBtnAdd.setEnabled(false);
                }
                else
                {
                    jxBtnUpdate.setEnabled(false);
                    jxBtnDelete.setEnabled(false);
                    jxBtnCancel.setEnabled(false); 
                    jxBtnAddTo.setEnabled(false);
                    jxBtnRemove.setEnabled(false); 
                    jxBtnAdd.setEnabled(true);
                }
             }
             else{
                jxBtnUpdate.setEnabled(false);
                jxBtnAdd.setEnabled(false);
             }
        }
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jxpanDetails = new org.jdesktop.swingx.JXPanel();
        jpanTableDetails = new javax.swing.JPanel();
        jpanContent = new javax.swing.JPanel();
        jxpanFindNavibar = new org.jdesktop.swingx.JXPanel();
        jxSearchFaculty = new org.jdesktop.swingx.JXSearchField();
        jXLabel1 = new org.jdesktop.swingx.JXLabel();
        jXLabel2 = new org.jdesktop.swingx.JXLabel();
        jXLabel3 = new org.jdesktop.swingx.JXLabel();
        jxLblSemesterYear = new org.jdesktop.swingx.JXLabel();
        jpanFuntionalDetails = new javax.swing.JPanel();
        jxBtnAdd = new org.jdesktop.swingx.JXButton();
        jxBtnUpdate = new org.jdesktop.swingx.JXButton();
        jxBtnDelete = new org.jdesktop.swingx.JXButton();
        jxBtnSave = new org.jdesktop.swingx.JXButton();
        jxBtnCancel = new org.jdesktop.swingx.JXButton();
        jxpanCenter = new org.jdesktop.swingx.JXPanel();
        jXPanel1 = new org.jdesktop.swingx.JXPanel();
        jScrollPane = new javax.swing.JScrollPane();
        jxTbAllSubjects = new mnstudent.global.MyTable();
        jXPanel4 = new org.jdesktop.swingx.JXPanel();
        jxBtnAddTo = new org.jdesktop.swingx.JXButton();
        jxBtnRemove = new org.jdesktop.swingx.JXButton();
        jXPanel2 = new org.jdesktop.swingx.JXPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jxTbOpenSubjects = new mnstudent.global.MyTable();
        jxpanHeader = new org.jdesktop.swingx.JXPanel();
        jxpanTitleHeader = new org.jdesktop.swingx.JXPanel();
        jXLabel5 = new org.jdesktop.swingx.JXLabel();
        jxpanInfoHeader = new org.jdesktop.swingx.JXPanel();
        jxpanInfo = new org.jdesktop.swingx.JXPanel();
        jxLabNameOfFaculty = new org.jdesktop.swingx.JXLabel();
        jxCbSemester = new org.jdesktop.swingx.JXComboBox();
        jxLabNameOfFaculty2 = new org.jdesktop.swingx.JXLabel();
        jxCbYear = new org.jdesktop.swingx.JXComboBox();

        setLayout(new java.awt.BorderLayout());

        jxpanDetails.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jxpanDetails.setLayout(new java.awt.BorderLayout());

        jpanTableDetails.setLayout(new java.awt.BorderLayout());

        jpanContent.setLayout(new java.awt.BorderLayout());

        jxpanFindNavibar.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jxpanFindNavibar.setPreferredSize(new java.awt.Dimension(914, 30));

        jXLabel1.setText("Tìm kiếm:");

        jXLabel2.setText("Danh sách tất cả các môn học");

        jXLabel3.setText("Danh sách các môn học được mở:");

        javax.swing.GroupLayout jxpanFindNavibarLayout = new javax.swing.GroupLayout(jxpanFindNavibar);
        jxpanFindNavibar.setLayout(jxpanFindNavibarLayout);
        jxpanFindNavibarLayout.setHorizontalGroup(
            jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jxpanFindNavibarLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jXLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(530, 530, 530)
                .addComponent(jXLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jxLblSemesterYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
                .addComponent(jXLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jxSearchFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jxpanFindNavibarLayout.setVerticalGroup(
            jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jxpanFindNavibarLayout.createSequentialGroup()
                .addGroup(jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jxSearchFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jXLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jxpanFindNavibarLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jXLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jXLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jxLblSemesterYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jpanContent.add(jxpanFindNavibar, java.awt.BorderLayout.NORTH);

        jxBtnAdd.setText("Thêm mới");
        jxBtnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnAddActionPerformed(evt);
            }
        });

        jxBtnUpdate.setText("Sửa đổi");
        jxBtnUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnUpdateActionPerformed(evt);
            }
        });

        jxBtnDelete.setText("Xóa bỏ");
        jxBtnDelete.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                jxBtnDeleteAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });
        jxBtnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnDeleteActionPerformed(evt);
            }
        });

        jxBtnSave.setText("Lưu xuống");
        jxBtnSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnSaveActionPerformed(evt);
            }
        });

        jxBtnCancel.setText("Hủy bỏ");
        jxBtnCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnCancelActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpanFuntionalDetailsLayout = new javax.swing.GroupLayout(jpanFuntionalDetails);
        jpanFuntionalDetails.setLayout(jpanFuntionalDetailsLayout);
        jpanFuntionalDetailsLayout.setHorizontalGroup(
            jpanFuntionalDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanFuntionalDetailsLayout.createSequentialGroup()
                .addContainerGap(351, Short.MAX_VALUE)
                .addComponent(jxBtnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(56, 56, 56)
                .addComponent(jxBtnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44)
                .addComponent(jxBtnDelete, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(50, 50, 50)
                .addComponent(jxBtnSave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(50, 50, 50)
                .addComponent(jxBtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(350, Short.MAX_VALUE))
        );
        jpanFuntionalDetailsLayout.setVerticalGroup(
            jpanFuntionalDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanFuntionalDetailsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpanFuntionalDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jxBtnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxBtnDelete, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxBtnSave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxBtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxBtnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        jpanContent.add(jpanFuntionalDetails, java.awt.BorderLayout.PAGE_END);

        jxpanCenter.setLayout(new javax.swing.BoxLayout(jxpanCenter, javax.swing.BoxLayout.LINE_AXIS));

        jXPanel1.setLayout(new java.awt.BorderLayout());

        jxTbAllSubjects.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã môn học", "Tên môn học", "Loại môn học", "Số tín chỉ"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jxTbAllSubjects.setEditable(false);
        jxTbAllSubjects.setGridColor(new java.awt.Color(153, 153, 153));
        jxTbAllSubjects.setSelectionBackground(new java.awt.Color(204, 204, 204));
        jxTbAllSubjects.setSortsOnUpdates(false);
        jxTbAllSubjects.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jxTbAllSubjectsMousePressed(evt);
            }
        });
        jScrollPane.setViewportView(jxTbAllSubjects);

        jXPanel1.add(jScrollPane, java.awt.BorderLayout.CENTER);

        jxpanCenter.add(jXPanel1);

        jxBtnAddTo.setText(">>");
        jxBtnAddTo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnAddToActionPerformed(evt);
            }
        });

        jxBtnRemove.setText("<<");
        jxBtnRemove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnRemoveActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jXPanel4Layout = new javax.swing.GroupLayout(jXPanel4);
        jXPanel4.setLayout(jXPanel4Layout);
        jXPanel4Layout.setHorizontalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel4Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jxBtnAddTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxBtnRemove, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
        jXPanel4Layout.setVerticalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel4Layout.createSequentialGroup()
                .addContainerGap(123, Short.MAX_VALUE)
                .addComponent(jxBtnAddTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jxBtnRemove, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(216, Short.MAX_VALUE))
        );

        jxpanCenter.add(jXPanel4);

        jXPanel2.setLayout(new java.awt.BorderLayout());

        jxTbOpenSubjects.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã môn học", "Tên môn học", "Loại môn học", "Số tín chỉ"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jxTbOpenSubjects.setEditable(false);
        jxTbOpenSubjects.setGridColor(new java.awt.Color(153, 153, 153));
        jxTbOpenSubjects.setSelectionBackground(new java.awt.Color(204, 204, 204));
        jxTbOpenSubjects.setSortsOnUpdates(false);
        jxTbOpenSubjects.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jxTbOpenSubjectsMousePressed(evt);
            }
        });
        jScrollPane2.setViewportView(jxTbOpenSubjects);

        jXPanel2.add(jScrollPane2, java.awt.BorderLayout.CENTER);

        jxpanCenter.add(jXPanel2);

        jpanContent.add(jxpanCenter, java.awt.BorderLayout.CENTER);

        jpanTableDetails.add(jpanContent, java.awt.BorderLayout.CENTER);

        jxpanDetails.add(jpanTableDetails, java.awt.BorderLayout.CENTER);

        add(jxpanDetails, java.awt.BorderLayout.CENTER);

        jxpanHeader.setLayout(new java.awt.BorderLayout());

        jxpanTitleHeader.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());

        jXLabel5.setForeground(new java.awt.Color(0, 102, 255));
        jXLabel5.setText("NHẬP MÔN HỌC MỞ THEO HỌC KỲ - NĂM HỌC");
        jXLabel5.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
        jxpanTitleHeader.add(jXLabel5);

        jxpanHeader.add(jxpanTitleHeader, java.awt.BorderLayout.PAGE_START);

        jxpanInfoHeader.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jxpanInfoHeader.setLayout(new java.awt.BorderLayout());

        jxpanInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "THÔNG TIN", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP));

        jxLabNameOfFaculty.setText("Học kỳ ");

        jxCbSemester.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxCbSemesterActionPerformed(evt);
            }
        });

        jxLabNameOfFaculty2.setText("Năm học");

        jxCbYear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxCbYearActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jxpanInfoLayout = new javax.swing.GroupLayout(jxpanInfo);
        jxpanInfo.setLayout(jxpanInfoLayout);
        jxpanInfoLayout.setHorizontalGroup(
            jxpanInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jxpanInfoLayout.createSequentialGroup()
                .addGap(96, 96, 96)
                .addComponent(jxLabNameOfFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jxCbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(142, 142, 142)
                .addComponent(jxLabNameOfFaculty2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jxCbYear, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(600, Short.MAX_VALUE))
        );
        jxpanInfoLayout.setVerticalGroup(
            jxpanInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jxpanInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jxpanInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jxLabNameOfFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxCbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxLabNameOfFaculty2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxCbYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 14, Short.MAX_VALUE))
        );

        jxpanInfoHeader.add(jxpanInfo, java.awt.BorderLayout.CENTER);

        jxpanHeader.add(jxpanInfoHeader, java.awt.BorderLayout.CENTER);

        add(jxpanHeader, java.awt.BorderLayout.NORTH);
    }// </editor-fold>//GEN-END:initComponents

    private void jxBtnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnCancelActionPerformed

        cancelAction();
    }//GEN-LAST:event_jxBtnCancelActionPerformed

    private void jxBtnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnSaveActionPerformed

        save();
    }//GEN-LAST:event_jxBtnSaveActionPerformed

    private void jxBtnDeleteAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jxBtnDeleteAncestorAdded
        // TODO add your handling code here:
    }//GEN-LAST:event_jxBtnDeleteAncestorAdded

    private void jxBtnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnDeleteActionPerformed

        int rs = JOptionPane.showOptionDialog(null,
            "Bạn có muốn xóa không!",
            "Câu hỏi",
            JOptionPane.YES_NO_OPTION,
            JOptionPane.QUESTION_MESSAGE,
            null,
            null,
            null);
        if(rs == 0)
        {
            if(isDelete())
            {
                JOptionPane.showOptionDialog(null,
                    "Xóa thành công!",
                    "Thông báo",
                    JOptionPane.YES_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    null,
                    null);
                //neu luu thanh cong
                this.jxTbAllSubjects.m_isAdd = false;
                this.jxTbAllSubjects.m_isUpdate = false;
                initControls();
                jxBtnUpdate.setEnabled(false);
                jxBtnDelete.setEnabled(false);
            }
            else
                JOptionPane.showMessageDialog(null, "Xóa thất bại. Vui lòng kiểm tra lại!", "Lỗi", JOptionPane.YES_OPTION);
        }
    }//GEN-LAST:event_jxBtnDeleteActionPerformed

    private void jxBtnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnUpdateActionPerformed

        listSubjectOpenToUpdate = new ArrayList<>();
        for(SubjectDisplay obj: listSubjectOpen)
            listSubjectOpenToUpdate.add(obj);
        this.jxTbOpenSubjects.m_isUpdate = true;
        initControls();
        jxBtnDelete.setEnabled(false);
        this.jxTbAllSubjects.requestFocus();
    }//GEN-LAST:event_jxBtnUpdateActionPerformed

    private void jxBtnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnAddActionPerformed

        if(!this.jxTbOpenSubjects.m_isAdd){
            this.jxTbOpenSubjects.m_isAdd = true;
            initControls();
            jxBtnDelete.setEnabled(false);
            listSubjectOpen.clear();
            initJTableForSubjectOpen(listSubjectOpen);
        }
    }//GEN-LAST:event_jxBtnAddActionPerformed

    private void jxBtnAddToActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnAddToActionPerformed
        if(jxTbAllSubjects.getRowCount()>0&&jxCbSemester.getSelectedItem()!= null && jxCbYear.getSelectedItem()!= null)
        {
            int[] row = jxTbAllSubjects.getSelectedRows();
            for(int i : row){
                SubjectDisplay objSub = new SubjectDisplay(jxTbAllSubjects.getValueAt(i, 0).toString(), 
                        jxTbAllSubjects.getValueAt(i, 1).toString(),
                        jxTbAllSubjects.getValueAt(i, 2).toString(),
                        Integer.valueOf(jxTbAllSubjects.getValueAt(i, 3).toString()));
                if(jxTbOpenSubjects.m_isAdd){
                    if(!listSubjectOpen.contains(objSub))
                        listSubjectOpen.add(objSub);
                    initJTableForSubjectOpen(listSubjectOpen);
            }
            else
                if(jxTbOpenSubjects.m_isUpdate)
                {
                    if(!listSubjectOpenToUpdate.contains(objSub))
                        listSubjectOpenToUpdate.add(objSub);
                    initJTableForSubjectOpen(listSubjectOpenToUpdate);
                }
            }
        }
    }//GEN-LAST:event_jxBtnAddToActionPerformed

    private void jxBtnRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnRemoveActionPerformed
        if(jxTbOpenSubjects.getRowCount()>0&&jxCbSemester.getSelectedItem()!= null&&jxCbYear.getSelectedItem()!= null)
        {
            int[] row = jxTbOpenSubjects.getSelectedRows();
            for(int i = row.length - 1; i>=0; i--){
            SubjectDisplay objSub = new SubjectDisplay(jxTbOpenSubjects.getValueAt(row[i], 0).toString(), 
                    jxTbOpenSubjects.getValueAt(row[i], 1).toString(),
                    jxTbOpenSubjects.getValueAt(row[i], 2).toString(),
                    Integer.valueOf(jxTbOpenSubjects.getValueAt(row[i], 3).toString()));
            if(jxTbOpenSubjects.m_isAdd){
                if(listSubjectOpen.contains(objSub))
                    listSubjectOpen.remove(objSub);
                initJTableForSubjectOpen(listSubjectOpen);
            }
            else
                if(jxTbOpenSubjects.m_isUpdate)
                {
                    if(listSubjectOpenToUpdate.contains(objSub))
                        listSubjectOpenToUpdate.remove(objSub);
                    initJTableForSubjectOpen(listSubjectOpenToUpdate);
                }
            }
        }
    }//GEN-LAST:event_jxBtnRemoveActionPerformed

    private void jxCbYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxCbYearActionPerformed
        if(jxCbYear.getSelectedItem() != null)
        {
            AcademicYearDTO objYear = (AcademicYearDTO)jxCbYear.getSelectedItem();
            if (objYear.equals(objAddNewYear)) {
                JOptionPane.showMessageDialog(null, "Thêm mới NAM HOC!");
                jxCbYear.setSelectedItem(null);
            } else {
                if(jxCbSemester.getSelectedItem() != null){
                    SemesterDTO objSemester = (SemesterDTO)jxCbSemester.getSelectedItem();
                    jxLblSemesterYear.setText(objSemester.toString()+ ", " + objYear.toString());
                    //Lay ngay bat dau dk mon hoc
//                    java.sql.Date date = m_InfoSemesterYearBLL.getInfoSemesterYearByIdSemesterAndIdYear(((SemesterDTO)jxCbSemester.getSelectedItem()).getSemesterID(), obj.getAcademicYearID()).getDateStartCourseRegistration();
                    InfoSemesterYearDTO objInfoSemesterYear =  m_InfoSemesterYearBLL.getInfoSemesterYearByIdSemesterAndIdYear(
                                    objSemester.getSemesterID(), 
                                    objYear.getAcademicYearID());
                    if(objInfoSemesterYear != null)
                    {
                        dateStartRegistrationCourse = objInfoSemesterYear.getDateStartCourseRegistration();
                        
                         
                        if (!this.jxTbAllSubjects.m_isAdd || !this.jxTbAllSubjects.m_isUpdate) {
                            listSubjectOpen = m_ListSubjectOpenBLL.getAllListSubjectOpenBySemesterYearToArray(objYear.getAcademicYearID(), objSemester.getSemesterID());
                            initJTableForSubjectOpen(listSubjectOpen);
                            initJButton(objYear.getNameOfAcademicYear());
                        }
                    
//                    jxLblSemesterYear.setText(objSemester.toString()+ ", " + objYear.toString());
//                    if (!this.jxTbAllSubjects.m_isAdd || !this.jxTbAllSubjects.m_isUpdate) {
//                        String idSemester =  ((SemesterDTO)jxCbSemester.getSelectedItem()).getSemesterID();
//                        listSubjectOpen = m_ListSubjectOpenBLL.getAllListSubjectOpenBySemesterYearToArray(objYear.getAcademicYearID(), idSemester);
//                        initJTableForSubjectOpen(listSubjectOpen);
//                        initJButton(objYear.getNameOfAcademicYear());
                        //
//                        if(listSubjectOpen.size()>0){
////                            jxBtnAdd.setEnabled(false);
////                            jxBtnUpdate.setEnabled(true);
////                            jxBtnDelete.setEnabled(true);
//                            initJButton(obj.getNameOfAcademicYear());
//                        }
//                        else{
////                             jxBtnAdd.setEnabled(true);
////                            jxBtnUpdate.setEnabled(false);
////                            jxBtnDelete.setEnabled(false);
//                        }
                    }
                     else{
                        JOptionPane.showMessageDialog(null, "Chưa có thông tin về "+objSemester.toString() + " - " + objYear.toString()+". Vui lòng thêm thông tin!--> mơ form them thong tin cho ky do");
                    }
                }
            }
        }
    }//GEN-LAST:event_jxCbYearActionPerformed

    private void jxCbSemesterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxCbSemesterActionPerformed
       if(jxCbSemester.getSelectedItem() != null)
        {
            SemesterDTO objSemester = (SemesterDTO) jxCbSemester.getSelectedItem();
            if (objSemester.equals(objAddNewSemester)) {
                JOptionPane.showMessageDialog(null, "Thêm mới HOC KY!");
                jxCbSemester.setSelectedItem(null);
            } else {
                if(jxCbYear.getSelectedItem() != null){
                    
                    AcademicYearDTO objYear = (AcademicYearDTO)jxCbYear.getSelectedItem();
                    jxLblSemesterYear.setText(objSemester.toString() + ", " + jxCbSemester.getSelectedItem().toString());
                    //Lay ngay bat dau dk mon hoc
                    InfoSemesterYearDTO objInfoSemesterYear = m_InfoSemesterYearBLL.getInfoSemesterYearByIdSemesterAndIdYear(
                            objSemester.getSemesterID(), objYear.getAcademicYearID());
                    if(objInfoSemesterYear != null){
                    
                        dateStartRegistrationCourse = objInfoSemesterYear.getDateStartCourseRegistration();

                        if (!this.jxTbAllSubjects.m_isAdd || !this.jxTbAllSubjects.m_isUpdate){
                            
                            listSubjectOpen = m_ListSubjectOpenBLL.getAllListSubjectOpenBySemesterYearToArray(objYear.getAcademicYearID(), objSemester.getSemesterID());
                            initJTableForSubjectOpen(listSubjectOpen);
                            initJButton(objYear.getNameOfAcademicYear());
                            }  
                    }
                    else
                    {
                        JOptionPane.showMessageDialog(null, "Chưa có thông tin về "+objSemester.toString() + " - " + objYear.toString()+". Vui lòng thêm thông tin!--> mơ form them thong tin cho ky do");
                    }
                }
            }
        }
    }//GEN-LAST:event_jxCbSemesterActionPerformed

    private void jxTbAllSubjectsMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jxTbAllSubjectsMousePressed
        //Thiet lap cho 2 JXButton AddTo va Remove
        if(jxTbAllSubjects.getSelectedRow()>0)
        {
            jxBtnRemove.setEnabled(false);
            jxBtnAddTo.setEnabled(true);
        }
    }//GEN-LAST:event_jxTbAllSubjectsMousePressed

    private void jxTbOpenSubjectsMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jxTbOpenSubjectsMousePressed
        //Thiet lap cho 2 JXButton AddTo va Remove
        if(jxTbOpenSubjects.getSelectedRow()>0)
        {
            jxBtnRemove.setEnabled(true);
            jxBtnAddTo.setEnabled(false);
        }
    }//GEN-LAST:event_jxTbOpenSubjectsMousePressed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane;
    private javax.swing.JScrollPane jScrollPane2;
    private org.jdesktop.swingx.JXLabel jXLabel1;
    private org.jdesktop.swingx.JXLabel jXLabel2;
    private org.jdesktop.swingx.JXLabel jXLabel3;
    private org.jdesktop.swingx.JXLabel jXLabel5;
    private org.jdesktop.swingx.JXPanel jXPanel1;
    private org.jdesktop.swingx.JXPanel jXPanel2;
    private org.jdesktop.swingx.JXPanel jXPanel4;
    private javax.swing.JPanel jpanContent;
    private javax.swing.JPanel jpanFuntionalDetails;
    private javax.swing.JPanel jpanTableDetails;
    private org.jdesktop.swingx.JXButton jxBtnAdd;
    private org.jdesktop.swingx.JXButton jxBtnAddTo;
    private org.jdesktop.swingx.JXButton jxBtnCancel;
    private org.jdesktop.swingx.JXButton jxBtnDelete;
    private org.jdesktop.swingx.JXButton jxBtnRemove;
    private org.jdesktop.swingx.JXButton jxBtnSave;
    private org.jdesktop.swingx.JXButton jxBtnUpdate;
    private org.jdesktop.swingx.JXComboBox jxCbSemester;
    private org.jdesktop.swingx.JXComboBox jxCbYear;
    private org.jdesktop.swingx.JXLabel jxLabNameOfFaculty;
    private org.jdesktop.swingx.JXLabel jxLabNameOfFaculty2;
    private org.jdesktop.swingx.JXLabel jxLblSemesterYear;
    private org.jdesktop.swingx.JXSearchField jxSearchFaculty;
    private mnstudent.global.MyTable jxTbAllSubjects;
    private mnstudent.global.MyTable jxTbOpenSubjects;
    private org.jdesktop.swingx.JXPanel jxpanCenter;
    private org.jdesktop.swingx.JXPanel jxpanDetails;
    private org.jdesktop.swingx.JXPanel jxpanFindNavibar;
    private org.jdesktop.swingx.JXPanel jxpanHeader;
    private org.jdesktop.swingx.JXPanel jxpanInfo;
    private org.jdesktop.swingx.JXPanel jxpanInfoHeader;
    private org.jdesktop.swingx.JXPanel jxpanTitleHeader;
    // End of variables declaration//GEN-END:variables
}
